import org.junit.Before;
import org.junit.Test;

import javax.swing.text.html.Option;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @description:
 * @author: yexc
 * @date: 2018-12-23 13:53
 */
public class Lambda {

    List<User> userList = new ArrayList<>();

    List<Integer> integerList = new ArrayList<>();

    @Before
    public void init(){
        userList.add(new User(1,"ye1",100));
        userList.add(new User(2,"ye2",200));
        userList.add(new User(3,"ye3",300));
        integerList.add(1);
        integerList.add(2);
        integerList.add(3);
    }

    public static Integer get(int a ,int b){
        return 0;
    }


    @Test
    public void Reduce(){
        integerList.stream().forEach((i) ->{
            if(i == 1){
            }
        });
    }


    @Test
    public void peek(){
//        Map<String, List<User>> collect = userList.stream().peek(user -> user.setMoney(user.getMoney() * 2)).collect(Collectors.partitioningBy(user));
    }


    @Test
    public void flatMap(){
//        userList.stream().flatMap(list -> )
//                .forEach(user -> {
//                    System.out.println(user.toString());
//                });
    }

    @Test
    public void generate(){
        Stream.iterate(1, item -> item + 1).filter(integer -> integer  == 1);
    }

    @Test
    public void concat(){
        Stream.concat(Stream.of(1, 2, 3), Stream.of(5, 4))
                .forEach(integer -> System.out.print(integer + "  "));
    }








}
